Suppose I have two libraries, "lib1" and "lib2"; "lib2" depends on "lib1".
lib2 --> lib1
I know that if I modify a file in "lib1," "lib2" will be recompiled. But will all of "lib2" be recompiled, or just the files in "lib2" that depend on the modified files?
For example, suppose "lib1" contains two files, "Lib1a.java" and "Lib1b.java" and "lib2" contains two files, "Lib2a.java" and "Lib2b.java". Lib2a.java depends on Lib1a.java; Lib2b depends on Lib1b.java.
A: Lib2a.java --> Lib1a.java
B: Lib2b.java --> Lib2b.java
Now suppose I modify Lib1a.java (A). Will Lib2b.java (B) be recompiled, even though it doesn't depend on Lib1a.java (A)?
I tried to verify this myself by setting up a toy example, below, where I modified the string that Lib1a.java returns, but I couldn't figure out what was being recompiled, because Bazel cleverly didn't bother modifying the timestamps for Lib2a.class or Lib2b.class.
So, tell me plainly: does Lib2b.java get recompiled or not? And, how can I verify this for myself?
Lib1a.java
package com.example.lib1;
public class Lib1a {
public String lib1a() {
return "lib1a";
}
}
Lib1b.java
package com.example.lib1;
public class Lib1b {
public String lib1b() {
return "lib1b";
}
}
Lib2a.java
package com.example.lib2;
import com.example.lib1.Lib1a;
public class Lib2a {
public String lib2a() {
return (new Lib1a()).lib1a() + "lib2a";
}
}
Lib2b.java
package com.example.lib2;
import com.example.lib1.Lib1b;
public class Lib2b {
public String lib2b() {
return (new Lib1b()).lib1b() + "lib2b";
}
}