Skip to content

Commit

Permalink
Builder simplications (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
pepone authored Dec 3, 2021
1 parent b5f68f4 commit 645aa2b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,10 @@ class SliceExtension {

private def iceHome = null
private def iceVersion = null
private def iceArtifactVersion = null
private def srcDist = false
private def freezeHome = null
private def sliceDir = null
private def slice2java = null
private def slice2freezej = null
private def jarDir = null
private def cppPlatform = null
private def cppConfiguration = null
private def compat = null
Expand All @@ -39,7 +36,6 @@ class SliceExtension {
def _sliceDir = null
def _slice2java = null
def _slice2freezej = null
def _jarDir = null
def _cppPlatform = null
def _cppConfiguration = null
def _compat = null
Expand Down Expand Up @@ -117,17 +113,9 @@ class SliceExtension {
[_iceHome, "slice"] // Opt/source installs & Windows distribution
]

def jarDirectories = [
[_iceHome, "share", "java"], // Default usr install
[_iceHome, _compat ? "java-compat" : "java", "lib"], // Source distribution
[_iceHome, "lib"] // Opt style install & Windows distribution
]

def sliceDirCandidates = sliceDirectories.collect { it.join(File.separator) }
def jarDirCandidates = jarDirectories.collect { it.join(File.separator) }

_sliceDir = sliceDirCandidates.find { new File(it).exists() }
_jarDir = jarDirCandidates.find { new File(it).exists() }

if (!_sliceDir) {
LOGGER.warn("Unable to locate slice directory in iceHome (${iceHome})")
Expand Down Expand Up @@ -309,26 +297,21 @@ class SliceExtension {

iceHome = c._iceHome
iceVersion = c._iceVersion
iceArtifactVersion = parseVersion(c._iceVersion)
srcDist = c._srcDist
freezeHome = c._freezeHome
sliceDir = c._sliceDir
slice2java = c._slice2java
slice2freezej = c._slice2freezej
jarDir = c._jarDir
cppPlatform = c._cppPlatform
cppConfiguration = c._cppConfiguration
compat = c._compat
env = c._env

LOGGER.debug("Property: iceHome = ${iceHome}")
LOGGER.debug("Property: iceVersion = ${iceVersion}")
LOGGER.debug("Property: srcDist = ${srcDist}")
LOGGER.debug("Property: freezeHome = ${freezeHome}")
LOGGER.debug("Property: sliceDir = ${sliceDir}")
LOGGER.debug("Property: slice2java = ${slice2java}")
LOGGER.debug("Property: slice2freezej = ${slice2freezej}")
LOGGER.debug("Property: jarDir = ${jarDir}")
LOGGER.debug("Property: cppPlatform = ${cppPlatform}")
LOGGER.debug("Property: cppConfiguration = ${cppConfiguration}")
LOGGER.debug("Property: compat = ${compat}")
Expand Down Expand Up @@ -377,16 +360,6 @@ class SliceExtension {
return iceVersion
}

def getIceArtifactVersion() {
lazyInit()
return iceArtifactVersion
}

def getSrcDist() {
lazyInit()
return srcDist
}

def getFreezeHome() {
lazyInit()
return freezeHome
Expand All @@ -412,11 +385,6 @@ class SliceExtension {
return slice2freezej
}

def getJarDir() {
lazyInit()
return jarDir
}

def getCppPlatform() {
lazyInit()
return cppPlatform
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class SlicePluginPropertyTest extends TestCase {
// This test only works if ICE_HOME is not set
assumeTrue(System.getenv()['ICE_HOME'] == null)
assertTrue(project.slice.iceHome != "")
assertTrue(project.slice.srcDist == false)
assertTrue(project.slice.iceVersion != "" && project.slice.iceVersion != null)
assertTrue(new File(project.slice.slice2java).exists())
assertTrue(new File(project.slice.sliceDir).exists())
Expand All @@ -38,7 +37,6 @@ class SlicePluginPropertyTest extends TestCase {
project.slice.iceHome = iceHome
assertTrue(project.slice.iceHome != "")
assertNotNull(project.slice.iceHome)
assertTrue(project.slice.srcDist == false)
assertTrue(project.slice.iceVersion != "")
assertNotNull(project.slice.iceVersion)
assertTrue(new File(project.slice.slice2java).exists())
Expand All @@ -47,7 +45,7 @@ class SlicePluginPropertyTest extends TestCase {

@Test
public void testInvalidIceHome() {
// Test an bogus iceHome (non srcDist)
// Test a bogus iceHome
def tmpIceHome = File.createTempDir()
tmpIceHome.deleteOnExit()
project.slice.iceHome = tmpIceHome.toString()
Expand Down Expand Up @@ -75,10 +73,8 @@ class SlicePluginPropertyTest extends TestCase {
project.slice.iceHome = tmpIceHome.toString()

assertTrue(project.slice.iceHome == tmpIceHome.toString())
assertTrue(project.slice.srcDist == true)
assertTrue(project.slice.iceVersion == null)
assertTrue(project.slice.sliceDir == null)
assertTrue(project.slice.jarDir == null)
}

@Test
Expand Down

0 comments on commit 645aa2b

Please sign in to comment.