Skip to content

Commit

Permalink
Disable making generated source read-only. It interferes too much wit…
Browse files Browse the repository at this point in the history
…h the build.
  • Loading branch information
swaldman committed Feb 18, 2024
1 parent 4c0d213 commit 4aefc7b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
c3p0-0.10.0-pre3
-- Disable making generated source read-only. It interferes too much with the build.
-- Make generated source files read-only so we're less likely to accidentally edit them.
-- Have build fail if we try to build with an unexpected JVM version.
We want to use a consistent JVM version (currently 11) and target version (currently 7)
Expand Down
8 changes: 5 additions & 3 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ object c3p0 extends RootModule with JavaModule with PublishModule {

def readOnly( perms : os.PermSet ) : os.PermSet = perms -- WritePermissions

// i intended to make generated source dir contents read-only, but this prevents the build from
// overwriting when necessary. so this is not currently in use.
//
// i'd have to add logic to restore writability during rebuilds, cleans,
// etc which seems maybe too complicated.
def makeDirContentsReadOnly( dir : os.Path ) = os.walk(dir).foreach( p => os.perms.set(p, readOnly(os.perms(p))) )

def buildModTime : T[Long] = T.input {
Expand Down Expand Up @@ -125,7 +130,6 @@ object c3p0 extends RootModule with JavaModule with PublishModule {
System.err.println("Regenerating C3P0Substitutions.java")
os.write.over( path, data = text, createFolders = true )
}
makeDirContentsReadOnly(T.dest)
PathRef(T.dest)
}
def beangenGeneratedSourceDir = T.persistent { T.dest }
Expand All @@ -140,7 +144,6 @@ object c3p0 extends RootModule with JavaModule with PublishModule {
)
)
)()
makeDirContentsReadOnly(realDest)
PathRef(realDest)
}
def proxygenGeneratedSourceDir = T.persistent { T.dest }
Expand All @@ -154,7 +157,6 @@ object c3p0 extends RootModule with JavaModule with PublishModule {
)
)
)()
makeDirContentsReadOnly(realDest)
PathRef(realDest)
}

Expand Down

0 comments on commit 4aefc7b

Please sign in to comment.