Skip to content

Commit

Permalink
🍎 Corrigindo do instalador no Mac (#390)
Browse files Browse the repository at this point in the history
* 🍎 Adicionando imagem de fundo no dmg do instalador

* 🍎 Corrigindo associação de arquivos no Mac

* 💚 Atualizando o número da versão no Info.plist do Mac ao gerar o build
  • Loading branch information
Luiz Fernando Noschang authored and AlissonSteffens committed Oct 6, 2017
1 parent d4e9d48 commit 6c465c4
Show file tree
Hide file tree
Showing 5 changed files with 155 additions and 47 deletions.
28 changes: 24 additions & 4 deletions dist.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ dirs.installer.buildDir = new File(dirs.installer.baseDir, 'build')
dirs.installer.javaDir = new File(dirs.installer.buildDir, 'java')
dirs.installer.configurationsFile = new File(dirs.installer.baseDir, 'build-configurations.json')
dirs.versionFile = new File(rootProject.projectDir.getPath() + '/ide/src/main/resources/version.properties')
dirs.macInfo_plistFile = new File(rootProject.projectDir.getPath() + '/installer/arquivos/osx/Portugol Studio.app/Contents/Info.plist')

import groovy.json.JsonException
import groovy.json.JsonSlurper
Expand Down Expand Up @@ -96,6 +97,7 @@ import javax.swing.JButton
import javax.swing.JCheckBox
import javax.swing.JComboBox
import javax.swing.JFileChooser
import java.util.Calendar


class DistFrame extends JFrame
Expand All @@ -113,13 +115,15 @@ class DistFrame extends JFrame
private final File versionFile

private JPanel contentPanel

DistFrame(platforms, buildConfigurations, configurationsFile, versionFile) {

private final File plistFile

DistFrame(platforms, buildConfigurations, configurationsFile, versionFile, plistFile) {

this.buildConfigurations = buildConfigurations
this.configurationsFile = configurationsFile
this.versionFile = versionFile

this.plistFile = plistFile

buildConfigurations.versionChanged = false
saveConfigurations(buildConfigurations)
Expand Down Expand Up @@ -481,7 +485,23 @@ class DistFrame extends JFrame
String sep = System.getProperty("line.separator")
String content = string.substring(string.indexOf(sep) + sep.length())
fileOut.write(content.getBytes())


def projectVersion = newMajorNumber + '.' + newMinorNumber + '.' + newBuildNumber

if (!newReleaseName.isEmpty()) {

projectVersion = projectVersion + '-' + newReleaseName
}


def plistText = plistFile.text

plistText = plistText.replaceAll('##VERSION##', projectVersion)
plistText = plistText.replaceAll('##YEAR##', Integer.toString(Calendar.getInstance().get(Calendar.YEAR)))

plistFile.write(plistText)

buildConfigurations.versionChanged = true

saveConfigurations(buildConfigurations)
Expand Down Expand Up @@ -629,7 +649,7 @@ def getConfigurationsFromGui(){

UIManager.setLookAndFeel(UIManager.systemLookAndFeelClassName)

frame = new DistFrame(platforms, buildConfigurations, dirs.installer.configurationsFile, dirs.versionFile)
frame = new DistFrame(platforms, buildConfigurations, dirs.installer.configurationsFile, dirs.versionFile, dirs.macInfo_plistFile)
frame.visible = true
}
}
Expand Down
1 change: 1 addition & 0 deletions ide/src/main/java/br/univali/ps/ui/Lancador.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.net.ServerSocket;
import java.net.URL;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
Expand Down
77 changes: 50 additions & 27 deletions installer/arquivos/osx/Portugol Studio.app/Contents/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,73 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>Portugol Studio</string>
<key>CFBundleGetInfoString</key>
<string>Ambiente de desenvolvimento para aprender a programar na linguagem Portugol 2.0</string>
<key>CFBundleVersion</key>
<string>2.6</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleAllowMixedLocalizations</key>
<string>true</string>
<key>CFBundleExecutable</key>
<string>Portugol Studio</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>

<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>

<key>CFBundleSignature</key>
<string>????</string>

<key>CFBundleName</key>
<string>Portugol Studio</string>

<key>CFBundleExecutable</key>
<string>Portugol Studio</string>

<key>CFBundleVersion</key>
<string>##VERSION##</string>

<key>CFBundleShortVersionString</key>
<string>2.6</string>
<key>CFBundleIconFile</key>
<string>portugol-studio.icns</string>
<string>##VERSION##</string>

<key>CFBundleIdentifier</key>
<string>br.univali.portugol.studio</string>

<key>CFBundleGetInfoString</key>
<string>Ambiente de desenvolvimento para aprender a programar na linguagem Portugol 2.0</string>

<key>CFBundleIconFile</key>
<string>portugol-studio.icns</string>

<key>CFBundleAllowMixedLocalizations</key>
<string>true</string>

<key>NSHumanReadableCopyright</key>
<string>Copyright © LITE - UNIVALI, 2009 - ##YEAR##. Todos os direitos reservados</string>

<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>por</string>
</array>

<key>CFBundleTypeMIMETypes</key>
<array>
<string>application/x-portugol</string>
</array>

<key>CFBundleTypeName</key>
<string>br.univali.programa-portugol</string>
<string>Algoritmo em Portugol</string>

<key>CFBundleTypeRole</key>
<string>Editor</string>

<key>LSHandlerRank</key>
<string>Owner</string>

<key>NSDocumentClass</key>
<string>NSDocument</string>

<key>CFBundleTypeIconFile</key>
<string>arquivo-por.icns</string>

<key>LSItemContentTypes</key>
<array>
<string>br.univali.programa-portugol</string>
</array>
<key>CFBundleTypeIconFiles</key>
<array>
<string>arquivo-por.icns</string>
</array>
<key>CFBundleTypeExtensions</key>
<array>
<string>por</string>
<string>br.univali.portugol.algoritmo</string>
</array>
</dict>
</array>
Expand Down
Binary file added installer/imagens/dmg-background.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
96 changes: 80 additions & 16 deletions installer/installers-project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -501,22 +501,70 @@
<actionGroup>
<explanation>Mac</explanation>
<actionList>
<deleteFile>
<path>/Applications/UNIVALI</path>
<ruleList>
<fileExists>
<actionGroup>
<explanation>Removendo associações de arquivos</explanation>
<actionList>
<runProgram>
<program>/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister</program>
<programArguments>-u "/Applications/UNIVALI/Portugol Studio.app"</programArguments>
<ruleList>
<fileExists>
<path>/Applications/UNIVALI/Portugol Studio.app</path>
</fileExists>
</ruleList>
</runProgram>
<runProgram>
<program>/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister</program>
<programArguments>-u "${install_app_bundle_dir}"</programArguments>
<ruleList>
<fileExists>
<path>${install_app_bundle_dir}</path>
</fileExists>
</ruleList>
</runProgram>
</actionList>
</actionGroup>
<actionGroup>
<explanation>Removendo versão mais antiga criada com o Bitrock</explanation>
<actionList>
<deleteFile>
<path>/Applications/UNIVALI</path>
</fileExists>
</ruleList>
</deleteFile>
<deleteFile>
<path>/Applications/Portugol Studio.app</path>
<ruleList>
<fileExists>
<path>/Applications/UNIVALI</path>
</fileExists>
</ruleList>
</deleteFile>
</actionList>
</actionGroup>
<actionGroup>
<explanation>Removendo versões anteriores do Portugol Studio</explanation>
<actionList>
<runProgram>
<program>chmod</program>
<programArguments>755 "${install_app_dir}/desinstalar"</programArguments>
<ruleList>
<fileExists>
<path>${install_app_dir}/desinstalar</path>
</fileExists>
</ruleList>
</runProgram>
<runProgram>
<program>${install_app_dir}/desinstalar</program>
<programArguments>--mode unattended</programArguments>
<ruleList>
<fileExists>
<path>${install_app_dir}/desinstalar</path>
</fileExists>
</ruleList>
</runProgram>
</actionList>
<ruleList>
<fileExists>
<path>/Applications/Portugol Studio.app</path>
</fileExists>
</ruleList>
</deleteFile>
</actionGroup>
</actionList>
<ruleList>
<platformTest>
Expand Down Expand Up @@ -867,12 +915,8 @@ include /usr/share/nano/portugol.nanorc</text>
<explanation>Criando associações de arquivos</explanation>
<actionList>
<runProgram>
<program>defaults</program>
<programArguments>write com.apple.LaunchServices LSHandlers -array-add "&lt;dict&gt;&lt;key&gt;LSHandlerContentTag&lt;/key&gt;
&lt;string&gt;por&lt;/string&gt;&lt;key&gt;LSHandlerContentTagClass&lt;/key&gt;
&lt;string&gt;public.filename-extension&lt;/string&gt;&lt;key&gt;LSHandlerRoleAll&lt;/key&gt;
&lt;string&gt;br.univali.portugol.studio&lt;/string&gt;&lt;/dict&gt;"
</programArguments>
<program>/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister</program>
<programArguments>"${install_app_bundle_dir}"</programArguments>
</runProgram>

<!-- Restart the launch services to reload the configuration -->
Expand Down Expand Up @@ -968,6 +1012,25 @@ include /usr/share/nano/portugol.nanorc</text>
</platformTest>
</ruleList>
</actionGroup>
<actionGroup>
<explanation>Mac</explanation>
<actionList>
<actionGroup>
<explanation>Removendo associações de arquivos</explanation>
<actionList>
<runProgram>
<program>/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister</program>
<programArguments>-u "${install_app_bundle_dir}"</programArguments>
</runProgram>
</actionList>
</actionGroup>
</actionList>
<ruleList>
<platformTest>
<type>osx</type>
</platformTest>
</ruleList>
</actionGroup>
</preUninstallationActionList>
<postUninstallationActionList>
<actionGroup>
Expand Down Expand Up @@ -1168,6 +1231,7 @@ include /usr/share/nano/portugol.nanorc</text>
<enableTimestamp>1</enableTimestamp>
<height>450</height>
<installationScope>allusers</installationScope>
<osxDmgBackgroundImage>imagens/dmg-background.jpeg</osxDmgBackgroundImage>
<osxDmgTitle>Instalação do Portugol Studio</osxDmgTitle>
<requireInstallationByRootUser>1</requireInstallationByRootUser>
<saveRelativePaths>1</saveRelativePaths>
Expand Down

0 comments on commit 6c465c4

Please sign in to comment.